#ifndef THINNING_H
#define THINNING_H

#include <stdio.h>
#include <vector_types.h>
#include <math.h>
#include <cuda.h>

typedef struct skel {
  dim3 oneDimGrid;
  dim3 oneDimBlock;
  dim3 twoDimGrid; //FIXME deprecated, use stackX instead
  dim3 twoDimBlock;
  dim3 stackBlock;
  dim3 stackGrid;
  dim3 findCoordinatesGrid;
  int blockSize;
  int numThreads;
  int numVoxels;
  dim3 volDim;
  dim3 planeDim;
	
  unsigned char *voxels_dev;
  unsigned int voxelMemSize;
  unsigned char **gather_dev;
  unsigned int *gatherMemSizes;
  unsigned char *gathered;
  int gatherLevels;
  unsigned short *coordinateListWork_dev;
  unsigned short *coordinateList_dev;
  unsigned short *subListLengths_dev;
  unsigned short *subListLengths;
  unsigned short *nonZeroSubListLengths;
  unsigned int subListLengthsMemSize;
  unsigned int coordinateListMemSize;
  unsigned char *yzPlane_dev;
  unsigned char *yzPlane; //for testing purposes only
  unsigned int yzPlaneMemSize;
	
} Skeletoniser;
	

extern "C" void initSkeletoniser(Skeletoniser *skel);
extern "C" int setupSkeletoniser(Skeletoniser *skel,const dim3 volDim,const int numVoxels);
extern "C" int skeletonise(Skeletoniser *skel,unsigned char *voxels,unsigned char **stepBuffer=0);
extern "C" void cleanUp(Skeletoniser *skel);
extern "C" void printInfo();

#endif
